﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace WebStudio_Site_MVC
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.js/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }


        //事件

        #region 应用程序启动事件
        /// <summary>
        /// 应用程序启动事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        void Application_Start(Object sender, EventArgs e)
        {
            //注册路由
            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

        }
        #endregion

        #region 应用程序关闭事件
        /// <summary>
        /// 应用程序关闭事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        void Application_End(object sender, EventArgs e)
        {

        }
        #endregion

        #region 应用程序出错事件
        /// <summary>
        /// 应用程序出错事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        void Application_Error(Object sender, EventArgs e)
        {

        }
        #endregion

        #region 请求开始事件
        /// <summary>
        /// 请求开始事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        void Application_BeginRequest(Object sender, EventArgs e)
        {

        }
        #endregion

        #region 请求结束事件
        /// <summary>
        /// 请求结束事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        void Application_EndRequest(Object sender, EventArgs e)
        {

        }

        #endregion
    }
}